package com.iot.service.mqtt.service.acl;

import io.netty.channel.Channel;

import java.util.List;

/**
 * @Author: hszhou
 * @Date: 2025/5/14 9:59
 * @Description: 必须描述类做什么事情, 实现什么功能
 */
public class CompositeAclValidator implements AclValidator{

    private final List<AclValidator> validators;

    public CompositeAclValidator(List<AclValidator> validators) {
        this.validators = validators;
    }

    @Override
    public boolean checkPermission(Channel ctx, String action, String topic) {
        return validators.stream()
                .anyMatch(validator -> validator.checkPermission(ctx, action, topic));
    }

}
